<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>运单管理</title>
	<meta name="decorator" content="ani"/>
	<style>
		#searchresult
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}
		#searchresult1
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}
		#searchresult2
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}
		#searchresult3
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}

		.line
		{
			font-size: 15px;
			background: #E0E0E0;
			width: 140px;
			padding:0px;
		}
		.hover
		{
			background: #007ab8;
			width: 140px;
			color: #fff;
		}
		.std
		{
			width: 150px;
		}
	</style>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/tms/tmsWaybill/save3",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            $('#date').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#deliveryTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#arrivalTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#stowageDate').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#presentTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
		});
		
		function addRow(list, idx, tpl, row){
			$(list).append(Mustache.render(tpl, {
				idx: idx, delBtn: true, row: row
			}));
			$(list+idx).find("select").each(function(){
				$(this).val($(this).attr("data-value"));
			});
			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
				var ss = $(this).attr("data-value").split(',');
				for (var i=0; i<ss.length; i++){
					if($(this).val() == ss[i]){
						$(this).attr("checked","checked");
					}
				}
			});
			$(list+idx).find(".form_datetime").each(function(){
				 $(this).datetimepicker({
					 format: "YYYY-MM-DD HH:00"
			    });
			});
		}
		function delRow(obj, prefix){
			var id = $(prefix+"_id");
			var delFlag = $(prefix+"_delFlag");
			if (id.val() == ""){
				$(obj).parent().parent().remove();
			}else if(delFlag.val() == "0"){
				delFlag.val("1");
				$(obj).html("&divide;").attr("title", "撤销删除");
				$(obj).parent().parent().addClass("error");
			}else if(delFlag.val() == "1"){
				delFlag.val("0");
				$(obj).html("&times;").attr("title", "删除");
				$(obj).parent().parent().removeClass("error");
			}
		}
		function chek(a,b) {
		    var c=a.value;
          if(parseInt(c)>parseInt(b)){
              $("#"+b).val("");
              jp.error("派车量不能大于剩余数量！");

		  }
			
        }
        function add() {
            jp.openDialog('新增承运商', "${ctx}/infor/carrier/form1",'1200px', '800px', $('#carrierTable'));
        }
        function adddriver() {
            jp.openDialog('新增司机', "${ctx}/infor/driver/form1",'1200px', '800px', $('#carrierTable'));
        }
        function addtruck() {
            jp.openDialog('新增车辆', "${ctx}/infor/truck/form1",'1200px', '800px', $('#carrierTable'));
        }
        function addaccount() {
            jp.openDialog('新增收款账户', "${ctx}/infor/account/form1",'1200px', '800px', $('#carrierTable'));
        }


		function se(evt) {
            ChangeCoords(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#commonCarrier").val() != "" && k == 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/carrier/getCarrierByName?name="+$("#commonCarrier").val(),
                    //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        jp.error("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line' id='"+item.id+"'><td class='std'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";
                            //将结果添加到div中
                            $("#searchresult").empty();
                            $("#searchresult").append(layer);
                            $(".line:first").addClass("hover");
                            $("#searchresult").css("display", "");
                            //鼠标移动事件

                            $(".line").hover(function () {
                                $(".line").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line").click(function () {
                                $("#commonCarrier").val($(this).text());
                                tc($(this).attr("id"));
                                $("#searchresult").css("display", "none");
                            });
                        } else {
                            $("#searchresult").empty();
                            $("#searchresult").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $('#commonCarrier').val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $('#commonCarrier').val($('#aa tr.hover').text());
            }

            else {
                $("#searchresult").empty();
                $("#searchresult").css("display", "none");
            }
        };
        function cx(evt) {
            ChangeCoords3(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#payeeName").val() != "" &&  k == 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/account/getByName?name="+$("#payeeName").val(),
                    //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        jp.error("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa3'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line3' name='"+item.code+"' id='"+item.bank+"'><td class='std'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";
                            //将结果添加到div中
                            $("#searchresult3").empty();
                            $("#searchresult3").append(layer);
                            $(".line:first").addClass("hover");
                            $("#searchresult3").css("display", "");
                            //鼠标移动事件

                            $(".line3").hover(function () {
                                $(".line3").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line3").click(function () {
                                $("#payeeName").val($(this).text());
                                $("#bankAddress").val($(this).attr("id"));
                                $("#cardNumber").val($(this).attr("name"));
                                $("#searchresult3").css("display", "none");
                            });
                        } else {
                            $("#searchresult3").empty();
                            $("#searchresult3").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $('#payeeName').val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $('#payeeName').val($('#aa tr.hover').text());
            }

            else {
                $("#searchresult3").empty();
                $("#searchresult3").css("display", "none");
            }
        };
        $("#searchresult").bind("mouseleave", function () {
            $("#searchresult").empty();
            $("#searchresult").css("display", "none");
        });
        $("#searchresult3").bind("mouseleave", function () {
            $("#searchresult3").empty();
            $("#searchresult3").css("display", "none");
        });
        function tc(id) {
            $.ajax({
                url:'${ctx}/infor/carrier/carriers?i='+id,
                success:function (data) {
                    $("#contacts").val(data.person);

                },
                error:function (data) {
                   jp.error("失败了");

                }
            })

        }
        function ChangeCoords() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#commonCarrier").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#commonCarrier").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult").css("top", top + "px"); //同上
        }
        function ChangeCoords3() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#payeeName").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#payeeName").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult3").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult3").css("top", top + "px"); //同上
        }
        function em(evt) {
            ChangeCoords1(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#plateNumber").val() != "" && k == 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/truck/getTruckName?name="+$("#plateNumber").val(),
                    //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        jp.error("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa1'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line1' id='"+item.id+"'><td class='std1'>" + item.truckNumber+ "</td></tr>";
                            });
                            layer += "</table>";
                            //将结果添加到div中
                            $("#searchresult1").empty();
                            $("#searchresult1").append(layer);
                            $(".line1:first").addClass("hover");
                            $("#searchresult1").css("display", "");
                            //鼠标移动事件

                            $(".line1").hover(function () {
                                $(".line1").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line1").click(function () {
                                $("#plateNumber").val($(this).text());
                                t($(this).attr("id"));
                                $("#searchresult1").css("display", "none");
                            });
                        } else {
                            $("#searchresult1").empty();
                            $("#searchresult1").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa1 tr.hover').prev().addClass("hover");
                $('#aa1 tr.hover').next().removeClass("hover");
                $('#plateNumber').val($('#aa1 tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa1 tr.hover').next().addClass("hover");
                $('#aa1 tr.hover').prev().removeClass("hover");
                $('#plateNumber').val($('#aa1 tr.hover').text());
            }

            else {
                $("#searchresult1").empty();
                $("#searchresult1").css("display", "none");
            }
        };
        $("#searchresult1").bind("mouseleave", function () {
            $("#searchresult1").empty();
            $("#searchresult1").css("display", "none");
        });
        function t(id) {
            $.ajax({
                url:'${ctx}/infor/truck/getTruckNumber?i='+id,
                success:function (data) {
                    $("#drivingLicense").val(data.license);
                    $("#vehicleType").val(data.remarks);


                },
                error:function (data) {
                    jp.error("失败了");

                }
            })

        }
        function ChangeCoords1() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#plateNumber").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#plateNumber").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult1").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult1").css("top", top + "px"); //同上
        }
        function mm(evt) {
            ChangeCoords2(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#driverName").val() != "" && k != 38 && k != 40 && k != 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/driver/getDriver?name="+$("#driverName").val(),
                    //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        jp.error("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa2'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line2' id='"+item.id+"'><td class='std2'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";
                            //将结果添加到div中
                            $("#searchresult2").empty();
                            $("#searchresult2").append(layer);
                            $(".line2:first").addClass("hover");
                            $("#searchresult2").css("display", "");
                            //鼠标移动事件

                            $(".line2").hover(function () {
                                $(".line2").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line2").click(function () {
                                $("#driverName").val($(this).text());
                                tm($(this).attr("id"));
                                $("#searchresult2").css("display", "none");
                            });
                        } else {
                            $("#searchresult2").empty();
                            $("#searchresult2").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa2 tr.hover').prev().addClass("hover");
                $('#aa2 tr.hover').next().removeClass("hover");
                $('#driverName').val($('#aa2 tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa2 tr.hover').next().addClass("hover");
                $('#aa2 tr.hover').prev().removeClass("hover");
                $('#driverName').val($('#aa2 tr.hover').text());
            }
            else if (k == 13) {//回车
                $('#driverName').val($('#aa2 tr.hover').text());
                tm($('#aa2 tr.hover').attr("id"));
                $("#searchresult2").empty();
                $("#searchresult2").css("display", "none");
            }
            else {
                $("#searchresult2").empty();
                $("#searchresult2").css("display", "none");
            }
        };
        $("#searchresult2").bind("mouseleave", function () {
            $("#searchresult2").empty();
            $("#searchresult2").css("display", "none");
        });
        function bb() {
            var a=$("#kdPayment").val();
            var b=$("#loadingPayment").val();  var c=$("#receiptCalculate").val();  var d=$("#rentingCost").val();
            if(a==null||a==""){
                a="0";
            }
            if(b==null||b==""){
                b="0";
            }if(c==null||c==""){
                c="0";
            }if(d==null||d==""){
                d="0";
            }
            $("#totalCost").val(parseInt(a)+parseInt(b)+parseInt(c));
            $("#freight").val(parseInt(a)+parseInt(b)+parseInt(c)+parseInt(d));
        }
        function tm(id) {
            $.ajax({
                url:'${ctx}/infor/driver/getById?i='+id,
                success:function (data) {
                    $("#driverPhone").val(data.phone);
                    $("#driveNumber").val(data.license);


                },
                error:function (data) {
                    jp.error("失败了");

                }
            })

        }
        function ChangeCoords2() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#driverName").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#driverName").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult2").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult2").css("top", top + "px"); //同上
        }



        function ceshi(val) {
            var v=$("#loadingPayment").val();
            if(v==""){
                jp.warning("请先填写装货付款")
                $("#loadingJe").val("");
                $("#loadingPayment").onfocus();
            }else if(val==""){
                return;
            }else if(parseFloat(val)>parseFloat(v)){
                jp.warning("油卡金额不能大于总金额")
                $("#loadingJe").val("");
                $("#loadingJe").onfocus();
            }

        }

	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="tmsWaybill" action="${ctx}/tms/tmsWaybill/save3" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<ul class="nav nav-tabs">
				<li class=""><a data-toggle="tab" href="#tab-01" aria-expanded="true">订单详情</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-02" aria-expanded="true">服务信息</a>
				</li>
				<li class="active"><a data-toggle="tab" href="#tab-03" aria-expanded="true">配载信息</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-04" aria-expanded="true">费用信息</a>
				</li>
			</ul>
			<div class="tab-content">
				<div id="tab-01" class="tab-pane fade ">
					<table class="table table-bordered">
						<tbody>
						<tr>
							<input type="hidden" name="pid" value="${tmsWaybill.pid}"/>
							<input type="hidden" name="workType" value="${tmsWaybill.workType}"/>
							<input type="hidden" name="arrive" value="${tmsWaybill.arrive}"/>
							<td class="width-10 active"><label class="pull-right">装运单号：</label></td>
							<td class="width-23">
								<form:input path="shipmentNumbers" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">下单日期：</label></td>
							<td class="width-23">
								<p class="input-group">
								<div class='input-group form_datetime' id='date'>
									<input type='text'  name="date" class="form-control "  value="<fmt:formatDate value="${tmsWaybill.date}" pattern="yyyy-MM-dd HH:00"/>"/>
									<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
								</div>
								</p>
							</td>
							<td class="width-10 active"><label class="pull-right">要求发货时间：</label></td>
							<td class="width-23">
								<p class="input-group">
								<div class='input-group form_datetime' id='deliveryTime'>
									<input type='text'  name="deliveryTime" class="form-control "  value="<fmt:formatDate value="${tmsWaybill.deliveryTime}" pattern="yyyy-MM-dd HH:00"/>"/>
									<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
								</div>
								</p>
							</td>
						</tr>
						<tr>

							<td class="width-10 active"><label class="pull-right">收货单位名称：</label></td>
							<td class="width-23">
								<form:input path="unitName" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">收货单位确认人：</label></td>
							<td class="width-23">
								<form:input path="unitConfirmor" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">确认人电话：</label></td>
							<td class="width-23">
								<form:input path="phone" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right">收货详细地址：</label></td>
							<td class="width-23">
								<form:input path="site" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">到站省：</label></td>
							<td class="width-23">
								<form:input path="arriveProvince" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">到站地城市：</label></td>
							<td class="width-23">
								<form:input path="arriveCity" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						<tr>

							<td class="width-10 active"><label class="pull-right">合同里程：</label></td>
							<td class="width-23">
								<form:input path="distance" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">运输线路：</label></td>
							<td class="width-23">
								<form:input path="transitLines" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">起始地：</label></td>
							<td class="width-23">
								<form:input path="contractDistance" htmlEscape="false"    class="form-control "/>
							</td>
						</tr></tbody></table>

				</div>
				<div id="tab-02" class="tab-pane fade">

					<table class="table table-bordered"><tbody>
					<tr>
						<td class="width-10 active"><label class="pull-right">委托单号：</label></td>
						<td class="width-23">
							<form:input path="entrustNumber" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-10 active"><label class="pull-right">项目名称：</label></td>
						<td class="width-23">
							<form:input path="projectName" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-10 active"><label class="pull-right">回单状态：</label></td>
						<td class="width-23">
							<form:input path="status" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-10 active"><label class="pull-right">运输方式：</label></td>
						<td class="width-23">
							<form:input path="transportMode" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-10 active"><label class="pull-right">结算方式：</label></td>
						<td class="width-23">
							<form:input path="clearingMode" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-10 active"><label class="pull-right">结算类型：</label></td>
						<td class="width-23">
							<form:input path="clearingType" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>


						<td class="width-10 active"><label class="pull-right">要求到货时间：</label></td>
						<td class="width-23">
							<p class="input-group">
							<div class='input-group form_datetime' id='arrivalTime'>
								<input type='text'  name="arrivalTime" class="form-control "  value="<fmt:formatDate value="${tmsWaybill.arrivalTime}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
							</p>
						</td>
						<td class="width-10 active"><label class="pull-right">备注信息：</label></td>
						<td class="width-23">
							<form:input path="remarks" htmlEscape="false"     class="form-control "/>
						</td>
					</tr>
					</tbody></table>
					<div style="height: 60px;"></div>
					<table class="table table-bordered" <c:if test="${list==null}">hidden="hidden"</c:if>>
						<tr>
							<th>物料类别</th>
							<th>计划量</th>
							<th>毛重</th>
							<th>体积</th>
							<th>提货仓库</th>
						</tr>
						<c:forEach items="${list}" var="map">
							<tr>
								<td>${map.type}</td>
								<td>${map.gross}</td>
								<td>${map.weight}</td>
								<td>${map.volume}</td>
								<td>${map.depot}</td>
							</tr>
						</c:forEach>
					</table>
				</div>
				<div id="tab-03" class="tab-pane fade in  active">
					<table class="table table-bordered">
						<tbody>
						<tr>
							<td class="width-10 active"><label class="pull-right">配载单号：</label></td>
							<td class="width-23">
								<form:input path="numbers" readonly="true" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">配载日期：</label></td>
							<td class="width-23">
								<%--<div class='input-group form_datetime' id='stowageDate'>--%>
									<input type='text'  name="stowageDate" readonly="readonly" class="form-control "  value="<fmt:formatDate value="${tmsWaybill.stowageDate}" pattern="yyyy-MM-dd HH:00"/>"/>
									<%--<span class="input-group-addon">--%>
			                        <%--<span class="glyphicon glyphicon-calendar"></span>--%>
			                    <%--</span>--%>
								<%--</div>--%>

							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>调度人员：</label></td>
							<td class="width-23">

								<sys:gridselect url="${ctx}/infor/staff/data" id="staff" name="dispatchName.id" value="${tmsWaybill.dispatchName.id}" labelName="dispatchName.name" labelValue="${tmsWaybill.dispatchName.name}"
												title="选择人员名称" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>
								<%--<form:input path="dispatchName" htmlEscape="false"    class="form-control "/>--%>
							</td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>现场督导：</label></td>
							<td class="width-23">
								<sys:gridselect url="${ctx}/infor/staff/data" id="guidance" name="guidance.id" value="${tmsWaybill.guidance.id}" labelName="guidance.name" labelValue="${tmsWaybill.guidance.name}"
												title="选择人员名称" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>
							</td>
							<td class="width-10 active"><label class="pull-right">托运类型：</label></td>
							<td class="width-23">
								<form:input path="consign" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">预计到场时间：</label></td>
							<td class="width-23">
								<div class='input-group form_datetime' id='presentTime'>
									<input type='text'  name="presentTime" class="form-control "  value="<fmt:formatDate value="${tmsWaybill.presentTime}" pattern="yyyy-MM-dd HH:00"/>"/>
									<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
								</div>
							</td>
						</tr>
							<%--<tr>--%>

							<%--<td class="width-15 active"><label class="pull-right">单据状态：</label></td>--%>
							<%--<td class="width-35">--%>
							<%--<form:input path="receiptsStatus" htmlEscape="false"    class="form-control "/>--%>
							<%--</td>--%>
							<%--</tr>--%>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>承运商：</label></td>
							<td class="width-23">
								<input id="commonCarrier"  onkeyup="se(event)"  autocomplete="off"  name="commonCarrier"    htmlEscape="false"    class="form-control required"/>
								<div id="searchresult" style="display: none;"></div>

							</td>
							<td class="width-10 active"><label class="pull-right">承运商联系人：</label></td>
							<td class="width-23">
								<form:input path="contacts" htmlEscape="false"       class="form-control "/>
							</td>
							<td colspan="2"><input onclick="add()" value="新增" type="button" class="btn-primary"/></td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>车牌号码：</label></td>
							<td class="width-23">
								<input id="plateNumber" name="plateNumber"  autocomplete="off"  onkeyup="em(event)"  htmlEscape="false"    class="form-control required"/>
								<div id="searchresult1" style="display: none;"></div>

							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>行驶证号：</label></td>
							<td class="width-23">
								<form:input path="drivingLicense" htmlEscape="false"    class="form-control required"/>
							</td>
							<td colspan="2"><input onclick="addtruck()"  value="新增" type="button" class="btn-primary"/></td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>司机姓名：</label></td>
							<td class="width-23">
								<input id="driverName"  name="driverName"   autocomplete="off"  htmlEscape="false"   onkeyup="mm(event)"  class="form-control required"/>
								<div id="searchresult2" style="display: none;"></div>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>司机电话：</label></td>
							<td class="width-23">
								<form:input path="driverPhone" htmlEscape="false"    class="form-control required"/>
							</td>
							<td colspan="2"><input onclick="adddriver()" value="新增" type="button" class="btn-primary"/></td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>车辆类型：</label></td>
							<td class="width-23">
								<input id="vehicleType" name="vehicleType"     htmlEscape="false"    class="form-control required"/>


							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>驾驶证号：</label></td>
							<td class="width-23">
								<form:input path="driveNumber" htmlEscape="false"    class="form-control required"/>
							</td>
							<td colspan="2"></td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right">提货流程：</label></td>
							<td class="width-89" colspan="5">
								<form:input path="delivery" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right">送货流程：</label></td>
							<td class="width-89" colspan="5">
								<form:input path="gaveCommodity" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right">注意事项：</label></td>
							<td class="width-89" colspan="5">
								<form:input path="attention" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						</tbody>
					</table>
					<div style="height: 50px;"></div>
					<input name="iii" value="${id}" type="hidden">
					<table class="table table-bordered text-nowrap">
						<tr>
							<th>提货单号</th>
							<th>物料名称</th>
							<th>物料编码</th>
							<th>物料规格</th>
							<th>计划量</th>
							<th>已派车量</th>
							<th>派车量</th>
							<th>毛重</th>
							<th>体积</th>
							<th>提货仓库</th>
						</tr>
						<c:forEach items="${goods}" var="good" varStatus="index">
                        <tr>
							<td>${good.number}</td>
							<td>${good.goods.name}</td>
							<td>${good.coding}</td>
							<td>${good.specification}</td>
							<td>${good.gross}</td>
							<td>${good.vehicleQuantity}</td>
							<td><input id="${good.remain}" onkeyup="chek(this,'${good.remain}')" value="${good.remain}" name="${good.id}"/></td>
							<td>${good.weight}</td>
							<td>${good.volume}</td>
							<td>${good.depot}</td>
						</tr>
						</c:forEach>
					</table>
				</div>
				<div id="tab-04" class="tab-pane fade ">
					<div style="height: 10px;"></div>
					<input onclick="addaccount()"  value="新增收款账户" type="button" class="btn-primary"/>
					<div style="height: 10px;"></div>
					<table class="table table-bordered">
						<tbody>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>收款人姓名：</label></td>
							<td class="width-23">
								<input id="payeeName"  onkeyup="cx(event)"  autocomplete="off"  name="payeeName"    htmlEscape="false"    class="form-control required"/>
								<div id="searchresult3" style="display: none;"></div>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>卡号：</label></td>
							<td class="width-23">
								<form:input path="cardNumber" htmlEscape="false"    class="form-control required"/>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>开户行：</label></td>
							<td class="width-23">
								<form:input path="bankAddress" htmlEscape="false"    class="form-control required"/>
							</td>
						</tr>
						<tr>

							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>装货付款：</label></td>
							<td class="width-23">
								<form:input path="loadingPayment" htmlEscape="false" onblur="bb()"   class="form-control required"/>
							</td>
							<td class="width-10 active"><label class="pull-right">支付方式：</label></td>
							<td class="width-23">
								<form:select path="loadingPaymentWay" class="form-control ">
									<form:options items="${fns:getDictList('pay_method_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>

							</td>
							<td class="width-10 active"><label class="pull-right">油卡卡号：</label></td>
							<td class="width-23">
								<form:input path="loadingCardNumber" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						<tr>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>货到付款：</label></td>
							<td class="width-23">
								<form:input path="kdPayment" htmlEscape="false"  onblur="bb()"   class="form-control required"/>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>凭回执结算：</label></td>
							<td class="width-23">
								<form:input path="receiptCalculate" htmlEscape="false" onblur="bb()"   class="form-control required"/>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>油卡金额(装货)：</label></td>
							<td class="width-23">
								<form:input path="loadingJe" htmlEscape="false" onblur="ceshi(this.value)"    class="form-control  required"/>

							</td>

						</tr>


						<tr>

							<td class="width-10 active"><label class="pull-right">合同费用：</label></td>
							<td class="width-23">
								<form:input path="totalCost" htmlEscape="false"  readonly="true"   class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">租车协议号：</label></td>
							<td class="width-23">
								<input id="forwardingPrice" placeholder="保存后自动生成" value="${tmsWaybill.forwardingPrice}" name="forwardingPrice" htmlEscape="false" readonly="true"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>租车费用：</label></td>
							<td class="width-23">
								<form:input path="rentingCost" htmlEscape="false"  onblur="bb()"  class="form-control required"/>
							</td>

						</tr>
						<tr><td class="width-10 active"><label class="pull-right">总运费：</label></td>
							<td class="width-23">
								<form:input path="freight" htmlEscape="false" readonly="true"   class="form-control "/>
							</td>

							<td class="width-10 active"><label class="pull-right">绩效运价：</label></td>
							<td class="width-23">
								<form:input path="performancePrice" htmlEscape="false"    class="form-control "/>
							</td>
							<td class="width-10 active"><label class="pull-right">历史运价：</label></td>
							<td class="width-23">
								<form:input path="historyPrice" htmlEscape="false"    class="form-control "/>
							</td>
						</tr>
						</tbody>
					</table>
					<div class="tabs-container">
						<ul class="nav nav-tabs">
							<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">运单附加费用：</a>
							</li>
						</ul>
						<div class="tab-content">
							<div id="tab-1" class="tab-pane fade in  active">
								<a class="btn btn-white btn-sm" onclick="addRow('#tmsAdditionalChargeList', tmsAdditionalChargeRowIdx, tmsAdditionalChargeTpl);tmsAdditionalChargeRowIdx = tmsAdditionalChargeRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
								<table class="table table-striped table-bordered table-condensed">
									<thead>
									<tr>
										<th class="hide"></th>
										<th>收支类型</th>
										<th>金额</th>
										<th>数量</th>
										<th>单价</th>
										<th>备注信息</th>
										<th width="10">&nbsp;</th>
									</tr>
									</thead>
									<tbody id="tmsAdditionalChargeList">
									</tbody>
								</table>
								<script type="text/template" id="tmsAdditionalChargeTpl">//<!--
				<tr id="tmsAdditionalChargeList{{idx}}">
					<td class="hide">
						<input id="tmsAdditionalChargeList{{idx}}_id" name="tmsAdditionalChargeList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
						<input id="tmsAdditionalChargeList{{idx}}_delFlag" name="tmsAdditionalChargeList[{{idx}}].delFlag" type="hidden" value="0"/>
					</td>

					<td>
					<select id="tmsAdditionalChargeList{{idx}}_balanceType" name="tmsAdditionalChargeList[{{idx}}].balanceType" data-value="{{row.balanceType}}" class="form-control m-b  ">

							<c:forEach items="${fns:getDictList('fee_type')}" var="dict">
								<option value="${dict.value}">${dict.label}</option>
							</c:forEach>
						</select>

<%--<select name="tmsAdditionalChargeList[{{idx}}].balanceType" id="tmsAdditionalChargeList{{idx}}_balanceType" class="form-control ">--%>
					<%--<option  value="收入">收入</option>--%>
					<%--<option  value="支出">支出</option>--%>
					<%--</select>					</td>--%>


					<td>
						<input id="tmsAdditionalChargeList{{idx}}_money" name="tmsAdditionalChargeList[{{idx}}].money" type="text" value="{{row.money}}"    class="form-control "/>
					</td>


					<td>
						<input id="tmsAdditionalChargeList{{idx}}_quantity" name="tmsAdditionalChargeList[{{idx}}].quantity" type="text" value="{{row.quantity}}"    class="form-control "/>
					</td>


					<td>
						<input id="tmsAdditionalChargeList{{idx}}_unitPrice" name="tmsAdditionalChargeList[{{idx}}].unitPrice" type="text" value="{{row.unitPrice}}"    class="form-control "/>
					</td>


					<td>
						<input  id="tmsAdditionalChargeList{{idx}}_remarks" name="tmsAdditionalChargeList[{{idx}}].remarks" rows="4"  value="{{row.remarks}}"  class="form-control "/>
					</td>

					<td class="text-center" width="10">
						{{#delBtn}}<span class="close" onclick="delRow(this, '#tmsAdditionalChargeList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
					</td>
				</tr>//-->
								</script>
								<script type="text/javascript">
                                    var tmsAdditionalChargeRowIdx = 0, tmsAdditionalChargeTpl = $("#tmsAdditionalChargeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
                                    $(document).ready(function() {
                                        var data = ${fns:toJson(tmsWaybill.tmsAdditionalChargeList)};
                                        for (var i=0; i<data.length; i++){
                                            addRow('#tmsAdditionalChargeList', tmsAdditionalChargeRowIdx, tmsAdditionalChargeTpl, data[i]);
                                            tmsAdditionalChargeRowIdx = tmsAdditionalChargeRowIdx + 1;
                                        }
                                    });
								</script>
							</div>

						</div>
					</div>
				</div>
		</div>
		</form:form>
</body>
</html>